<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.zl.customer.pojo.Userinfo" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  	<!-- target="main"   base标签: 在每个a标签添加target="main"属性-->
  <base target="main">
    <title>My JSP 'top.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body style="text-align: center;">
  	<h1>客户关系管理系统 
  		<%--<span style="float:right;">欢迎:<%=request.getAttribute("user")%>--%>
  		<%--<!-- _parent: 在父窗口打开--%>
  			<%--_self: 在自己的窗口打开--%>
  			<%--_blank: 新建一个窗口打开--%>
  			<%--frame的name: 指定的name的frame窗口打开--%>
  		 <%---->--%>
  			<%--<a href="<%=request.getContextPath() %>/logout.action" target="_parent">退出</a>--%>
  		<%--</span>--%>
        <%--<%
            Object loginUser = session.getAttribute("loginUser");

            if(loginUser != null){  //说明session有用户信息, 表示已登录
                String username = ((Userinfo)loginUser).getName();

         %>
            <span style="float:right;">欢迎:<%=username %>
                <a href="<%=request.getContextPath() %>/logout.action" target="_parent">退出</a>
            </span>
        <%
            }else{ //说明session没有用户信息, 表示未登录

        %>
        <span style="float:right;">
          <a style="color:red;text-decoration: none;" href="<%=request.getContextPath() %>/login.jsp" target="_parent" >亲,请登录</a>
        </span>
        <%
            }
        %>--%>
        <!--choose标签之间不能写注释-->
        <c:choose>
            <c:when test="${not empty loginUser}">
                 <span style="float:right;">欢迎:${loginUser.name}
                        <a href="<%=request.getContextPath() %>/logout.action" target="_parent">退出</a>
                 </span>
            </c:when>
            <c:otherwise>
                <a style="color:red;text-decoration: none;" href="<%=request.getContextPath() %>/login.jsp" target="_parent" >亲,请登录</a>
            </c:otherwise>
        </c:choose>
   </h1>
    <%--<c:if test="${empty sessionScope.loginUser}">target="_parent"</c:if>--%>
    <a href="${pageContext.request.contextPath}/jumpPage.do?page=add" <c:if test="${empty sessionScope.loginUser}">target="_parent"</c:if> >添加客户</a> 　|　
    <a href="<%=request.getContextPath() %>/QueryByPageServlet.action"  <c:if test="${empty sessionScope.loginUser}">target="_parent"</c:if>>查询客户</a>　|　
    <a href="${pageContext.request.contextPath}/jumpPage.do?page=query" <c:if test="${empty sessionScope.loginUser}">target="_parent"</c:if>>高级搜索</a>　　
  </body>
</html>
